<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象基础</title>
</head>
<body>
    <h1>对象基础</h1>
</body>
<script>
    //创建对象1.
    // var person=new Object();
    // person.name="孙悟空";
    // person.age=18;
    // document.write(person)
    // console.log(person)
    //访问对象
    // console.log(person.name)
    // console.log(person['age'])
    //删除对象
    // delete person.age
    // console.log(person)
    //遍历对象 

    var person={ //创建对象2.
        name: "张三",
        age: 18
    }

    for(var pkey in person){
        var pval=person[pkey]
        console.log(pkey+"  "+pval)
    }

</script>
</html>